package controller;

import java.rmi.RemoteException;
import java.util.ArrayList;

import model.PlayerInterface;
import toolkit.Debug;
import data.GameInterface;

public class PlayerOverview extends Controller
{
	public PlayerOverview()
	{
		setView(new view.PlayerOverview(this));
	}

	public ArrayList<PlayerInterface> getPlayerList()
	{
		try
		{
			return userRemote.getPlayers();
		}
		catch (RemoteException e)
		{
			Debug.log(e);
		}
		
		return null;
	}

	public ArrayList<PlayerInterface> getPlayersByUsername(String username)
	{
		try
		{
			return userRemote.getPlayersByUsername(username);
		}
		catch (RemoteException e)
		{
			Debug.log(e);
		}
		
		return null;
	}
	
	public void banPlayer(PlayerInterface player)
	{
		try
		{
			userRemote.banPlayer(player);
		}
		catch (RemoteException e)
		{
			Debug.log(e);
		}
	}
	
	public void messagePlayer(PlayerInterface player)
	{
		forward(new controller.NewMessage(player));
	}
	
	public void back()
	{
		forward(new controller.Lobby());
	}
}